package com.bang.study.spring.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Array;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.UUID;

/**
 * @ClassName: UserDao
 * @author: BANG
 * @Date: 2019/11/13 15:24
 * @Version: 1.0
 * @Modified By:
 * @Desc: TODO
 */
@Repository
public class UserDao {


    @Autowired
    private JdbcTemplate jdbcTemplate;

//    @Transactional
    public void add() {
        String sql = "INSERT INTO `roles`( `name`, `user_id`) VALUES ( ?,?);";
        String username = UUID.randomUUID().toString().substring(0, 5);
        jdbcTemplate.update(sql, username,19);
        int i = 1 / 0;
    }
}
